#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["ch9/Web.csproj", "ch9/"]
COPY ["../../devonline/src/core/http/Devonline.Http.csproj", "../../devonline/src/core/http/"]
COPY ["../../devonline/src/core/core/Devonline.Core.csproj", "../../devonline/src/core/core/"]
COPY ["../../devonline/src/core/entity/Devonline.Entity.csproj", "../../devonline/src/core/entity/"]
COPY ["../../devonline/src/core/utils/Devonline.Utils.csproj", "../../devonline/src/core/utils/"]
RUN dotnet restore "ch9/Web.csproj"
COPY . .
WORKDIR "/src/ch9"
RUN dotnet build "Web.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Web.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Web.dll"]